var zuocedaohuang = document.querySelectorAll("#zuocedaohuang>ul>li>div");
//物联设备
$("#bs-example-navbar-collapse-1 ul:nth-child(3) li:nth-child(2) a").click(function () {
    $("body").load("WuJiaHanWuLianSheBei.html");
})
//主页
$("#zuocedaohuang>ul>li:nth-child(1)").click(function () {
    $("body").load("index.html");
})
//修改密码
$("#zuocedaohuang>ul>li:nth-child(8)>ul>li:first-child").click(function () {
    $("body").load("yaoketongxiugaimm.html");
})
$(".dropdown-menu>li:first-child").click(function () {
    $("body").load("yaoketongxiugaimm.html");
})
//人员管理
$("#zuocedaohuang>ul>li:nth-child(2)>ul>li").click(function () {
    $("body").load("WuJiaHanRenYuanGuanLi.html");
})
//初始化
$("#zuocedaohuang>ul>li:nth-child(8)>ul>li:last-child").click(function () {
    $("body").load("chushihua.html");
})
//主页
$("#bs-example-navbar-collapse-1 ul:nth-child(3) li:nth-child(1) a").click(function () {
    $("body").load("index.html");
})

//物业管理
$("#zuocedaohuang>ul>li:nth-child(5)>ul>li:first-child").click(function () {
    $("body").load("HeLuYiJiaoFeiJiLu.html");
})
//订单管理
$("#zuocedaohuang>ul>li:nth-child(5)>ul>li:nth-child(2)").click(function () {
    $("body").load("HeLuYiDaiJiaoDingDan.html");
})
//收款账号
$("#zuocedaohuang>ul>li:nth-child(5)>ul>li:nth-child(3)").click(function () {
    $("body").load("HeLuYiShouKuanZhangHao.html");
})

//房源管理
$("#zuocedaohuang>ul>li:nth-child(3)>ul>li:first-child").click(function () {
    $("body").load("renchengdongfangyuanhuanli.html");
})
//房屋档案
$("#zuocedaohuang>ul>li:nth-child(3)>ul>li:nth-child(2)").click(function () {
    $("body").load("renchengdongfangwudangan.html");
})

//车位管理
$("#zuocedaohuang>ul>li:nth-child(4)>ul>li:first-child").click(function () {
    $("body").load("cx-chewguanli.html");
})
//车辆管理
$("#zuocedaohuang>ul>li:nth-child(4)>ul>li:nth-child(2)").click(function () {
    $("body").load("cx-chelguanli.html");
})

//工单配置
$("#zuocedaohuang>ul>li:nth-child(6)>ul>li:first-child").click(function () {
    $("body").load("第一个页面.html");
})
//报修管理
$("#zuocedaohuang>ul>li:nth-child(6)>ul>li:nth-child(2)").click(function () {
    $("body").load("第二个页面.html");
})
//物业信息
$("#zuocedaohuang>ul>li:nth-child(7)>ul>li:nth-child(3)").click(function () {
    $("body").load("YaoKeTongWuYeXingXi.html");
})
//信息服务
$("#zuocedaohuang>ul>li:nth-child(7)>ul>li:first-child").click(function () {
    $("body").load("LiuXueQiXinXiFuWu.html");
})
//账单配置
$("#zuocedaohuang>ul>li:nth-child(7)>ul>li:nth-child(2)").click(function () {
    $("body").load("LiuXueQiZhangDanPeiZhi.html");
})

$(".dropdown-toggle").click(function () {
    if (navpanding==1){
        $(".dropdown-menu").css("display","block");
        $(".dropdown-toggle").css("background-color","rgb(221,221,221)")
        navpanding=2;
    }else {
        $(".dropdown-menu").css("display","none");
        $(".dropdown-toggle").css("background-color","rgb(65,92,133)")
        navpanding=1;
    }
})

for(var i = 0 ;i<zuocedaohuang.length;i++){
    zuocedaohuang[i].onclick=function () {
        var liClick = this.parentNode;
        var haizi=liClick.querySelectorAll("ul>li");
        var liHeight = liClick.style.height;
        for(var n = 1 ;n<zuocedaohuang.length;n++){
            var fa=[];
            fa[n]= zuocedaohuang[n].parentNode;
            fa[n].style.height="50px";
            fa[n].style.transition="all 0.2s";
            zuocedaohuang[n].style.color="black";
            zuocedaohuang[n].querySelector("span").style.transform="rotatez(0deg)";
        }
        if(liHeight=="50px"){
            if(haizi&&haizi.length>0){
                this.style.color="black";
                liClick.style.height=50+haizi.length*50+"px";
                this.querySelector("span").style.transform="rotatez(180deg)";
                liClick.style.transition="all 0.2s";
            }
        }else {
            this.style.color="black";
            liClick.style.height="50px";
            this.querySelector("span").style.transform="rotatez(0deg)";
            liClick.style.transition="all 0.2s";
            this.querySelector("span").style.transform="rotatez(0deg)";
        }
    }
}
$(window).scroll(function () {
    var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
    var i=scrollTop;
    if (scrollTop>500){
        $("#zuocedaohuang>ul").css("margin-top",scrollTop+"px");
    }
    if (scrollTop<500){
        $("#zuocedaohuang>ul").css("margin-top","0");
    }
})





var xingming=$("#profile div:nth-child(1) input");
var dianhua=$("#profile div:nth-child(2) input");
var dizhi=$("#profile div:nth-child(3) input");
var zhuhuleixing=$("#profile select");
var chongzhi=$("#profile .btn-chongzhi");
var shanchuyemian=1;

var xingming1=$("#messages div:nth-child(1) input");
var dianhua1=$("#messages div:nth-child(2) input");
var dizhi1=$("#messages div:nth-child(3) input");
var zhuhuleixing1=$("#messages select");
var chongzhi1=$("#messages .btn-chongzhi");
var shanchuyemian1=1;




//存放所有用户
var users = users || {};
var users1 = users1 || {};
//操作类型
var operateType = "";
var operateType1 = "";
//存放搜索对象
var searchUsers = searchUsers || {};
var searchUsers1 = searchUsers || {};

var User = {
    Create:function(xh,xm,dh,xb,zz,zhlx,sj){
        this.xh = xh;
        this.xm = xm;
        this.dianhua = dh;
        this.xb = xb;
        this.zz = zz;
        this.zhlx = zhlx;
        this.sj = sj;
    },
    //添加用户
    addUserData:function(){
        if(this.xh != ""){
            users[this.xh] = this;
        }
    },
}

var User1 = {
    Create:function(xh,xm,dh,xb,zz,zhlx,sj){
        this.xh = xh;
        this.xm = xm;
        this.dianhua = dh;
        this.xb = xb;
        this.zz = zz;
        this.zhlx = zhlx;
        this.sj = sj;
    },
    //添加用户
    addUserData:function(){
        if(this.xh != ""){
            users1[this.xh] = this;
        }
    },
}


function New(aClass,aParams){
    function new_(){
        aClass.Create.apply(this,aParams);
    }
    new_.prototype = aClass;
    return new new_();
}

function New1(aClass,aParams){
    function new_1(){
        aClass.Create.apply(this,aParams);
    }
    new_1.prototype = aClass;
    return new new_1();
}

//bootstrap模态框事件
$('#myModal').on('hide.bs.modal', function () {
    // 执行一些动作...
    var inputElements = this.getElementsByTagName("input");
    var userArr = [];
    var userArr1 = [];
    for(var i=0;i<inputElements.length;i++){
        userArr[i] = inputElements[i].value;
        userArr1[i] = inputElements[i].value;
        this.getElementsByTagName("input")[i].value="";
    }

    var user = New(User,userArr);
    var user1 = New(User1,userArr1);
    //添加操作
    if(operateType == "add"){
        user.addUserData();
        refreshDatas(users);
        operateType="";
        yemashu();
        fanye1();
        shanchuyemian=1;
        yemaheshuj();
    }
    if(operateType1 == "add1"){

        user1.addUserData();
        refreshDatas1(users1);
        operateType1="";
        yemashu1();
        fanye11();
        shanchuyemian1=1;
        yemaheshuj1();
    }

});




/**
 * 往表格添加一行html数据
 */
function addRowData(datas){
    var tbodyElement = document.getElementById("tbody");
    var html = "";
    for(var i in datas){
        html = html +  "<tr><th>"
            + datas[i].xh +"</th><th>"
            + datas[i].xm +"</th><th>"
            + datas[i].dianhua +"</th><th>"
            + datas[i].xb +"</th><th>"
            + datas[i].zz +"</th><th>"
            + datas[i].zhlx +"</th><th>"
            + datas[i].sj +"</th><th><button data-toggle=\"modal\" data-target=\"#myModal\" onclick='bianji(this)'>编辑</button> <button onclick='shanchu(this)'>删除</button></th></tr>";
    }
    tbodyElement.innerHTML = html;
}
function addRowData1(datas){
    var tbodyElement1 = document.getElementById("tbody1");
    var html = "";
    for(var i in datas){
        html = html +  "<tr><th>"
            + datas[i].xh +"</th><th>"
            + datas[i].xm +"</th><th>"
            + datas[i].dianhua +"</th><th>"
            + datas[i].xb +"</th><th>"
            + datas[i].zz +"</th><th>"
            + datas[i].zhlx +"</th><th>"
            + datas[i].sj +"</th><th><button data-toggle=\"modal\" data-target=\"#myModal\" onclick='bianji1(this)'>编辑</button> <button onclick='shanchu1(this)'>删除</button></th></tr>";
    }
    tbodyElement1.innerHTML = html;
}
/**
 * 刷新用户数据
 */
shuchu()
shuaxing();
shuaxing1();

function shuaxing(){
    if(users)
    {addRowData(users);}
    operateType="";
    yemashu();
    fanye1();
    shanchuyemian=1;
    yemaheshuj();

}
function shuaxing1(){

    if(users1)
    { addRowData1(users1);}
    operateType1="";
    yemashu1();
    fanye11();
    shanchuyemian1=1;
    yemaheshuj1();
}

function refreshDatas(datas){
    addRowData(datas);
}
function refreshDatas1(datas){
    addRowData1(datas);
}

//显示
function shuchu() {
    if(yonghuqianrupanding==true){
        yonghuqianrupanding=false;
        init();
        users={};
        for (var i=0;i<yonghuqianru.length;i++){
            var initUser=New(User,yonghuqianru[i]);
            users[initUser.xh] = initUser;
        }
        // return users;
        var userArray = users;
        addRowData(userArray);
        refreshDatas(users);
        // fanye1();
        yemashu();
        fanye1();
        shanchuyemian=1;
        yemaheshuj();
    }
    if(yonghuqianchupanding==true){
        yonghuqianchupanding=false;
        users1={};
        init();
        for (var i=0;i<yonghuqianchu.length;i++){
            var initUser=New(User,yonghuqianchu[i]);
            users1[initUser.xh] = initUser;
        }
        var userArray1 = users1;
        addRowData1(userArray1);
        refreshDatas1(users1);
        // fanye1();
        yemashu1();
        fanye11();
        shanchuyemian=1;
        yemaheshuj1();
    }

}

// function initUserDatas(){
//     init();
//     for (var i=0;i<yonghuqianru.length;i++){
//         var initUser=New(User,yonghuqianru[i]);
//         users[initUser.xh] = initUser;
//     }
    // var initUser1 = New(User,["1","小兰","233","女","四川乐山","业主","2020-1-1"]);
    // var initUser2 = New(User,["2","张黄","854","男","四川成都","租户","2020-1-1"]);
    // var initUser3 = New(User,["3","小吕","452","女","四川绵阳","租户","2020-1-1"]);
    // var initUser4 = New(User,["4","小张","84","女","四川巴中","业主","2020-1-1"]);
    // var initUser5 = New(User,["5","小兰","233","女","四川乐山","业主","2020-1-1"]);
    // var initUser6 = New(User,["6","张黄","854","男","四川成都","租户","2020-1-1"]);
    // var initUser7 = New(User,["7","小吕","452","女","四川绵阳","租户","2020-1-1"]);
    // var initUser8 = New(User,["8","小张","84","女","四川巴中","业主","2020-1-1"]);
    // var initUser9 = New(User,["9","小兰","233","女","四川乐山","业主","2020-1-1"]);
    // var initUser10 = New(User,["10","张黄","854","男","四川成都","租户","2020-1-1"]);
    // var initUser11 = New(User,["11","小吕","452","女","四川绵阳","租户","2020-1-1"]);
    // var initUser12= New(User,["12","小张","84","女","四川巴中","业主","2020-1-1"]);
    // var initUser13= New(User,["13","小兰","233","女","四川乐山","业主","2020-1-1"]);
    // var initUser14= New(User,["14","张黄","854","男","四川成都","租户","2020-1-1"]);
    // var initUser15= New(User,["15","小吕","452","女","四川绵阳","租户","2020-1-1"]);
    // var initUser16= New(User,["16","小张","84","女","四川巴中","业主","2020-1-1"]);
    // var initUser17= New(User,["17","小兰","233","女","四川乐山","业主","2020-1-1"]);
    // var initUser18= New(User,["18","张黄","854","男","四川成都","租户","2020-1-1"]);
    // var initUser19= New(User,["19","小吕","452","女","四川绵阳","租户","2020-1-1"]);
    // var initUser20= New(User,["20","小张","84","女","四川巴中","业主","2020-1-1"]);
    // users[initUser1.xh] = initUser1;
    // users[initUser2.xh] = initUser2;
    // users[initUser3.xh] = initUser3;
    // users[initUser4.xh] = initUser4;
    // users[initUser5.xh] = initUser5;
    // users[initUser6.xh] = initUser6;
    // users[initUser7.xh] = initUser7;
    // users[initUser8.xh] = initUser8;
    // users[initUser9.xh] = initUser9;
    // users[initUser10.xh] = initUser10;
    // users[initUser11.xh] = initUser11;
    // users[initUser12.xh] = initUser12;
    // users[initUser13.xh] = initUser13;
    // users[initUser14.xh] = initUser14;
    // users[initUser15.xh] = initUser15;
    // users[initUser16.xh] = initUser16;
    // users[initUser17.xh] = initUser17;
    // users[initUser18.xh] = initUser18;
    // users[initUser19.xh] = initUser19;
    // users[initUser20.xh] = initUser20;
//     return users;
// }
// function initUserDatas1(){
//     init();
//     for (var i=0;i<yonghuqianchu.length;i++){
//         var initUser=New(User,yonghuqianchu[i]);
//         users1[initUser.xh] = initUser;
//     }
    // var initUser1 = New(User1,["1","小兰小","233","女","四川乐山","业主","2020-1-1"]);
    // var initUser2 = New(User1,["2","张黄小","854","男","四川成都","租户","2020-1-1"]);
    // var initUser3 = New(User1,["3","小吕小","452","女","四川绵阳","租户","2020-1-1"]);
    // var initUser4 = New(User1,["4","小张张","84","女","四川巴中","业主","2020-1-1"]);
    // var initUser5 = New(User1,["5","小兰兰","233","女","四川乐山","业主","2020-1-1"]);
    // var initUser6 = New(User1,["6","张黄黄","854","男","四川成都","租户","2020-1-1"]);
    // var initUser7 = New(User1,["7","小吕吕","452","女","四川绵阳","租户","2020-1-1"]);
    // var initUser8 = New(User1,["8","小张张","84","女","四川巴中","业主","2020-1-1"]);
    // var initUser9 = New(User1,["9","小兰","233","女","四川乐山","业主","2020-1-1"]);
    // var initUser10 = New(User1,["10","张黄","854","男","四川成都","租户","2020-1-1"]);
    // var initUser11 = New(User1,["11","小吕","452","女","四川绵阳","租户","2020-1-1"]);
    // var initUser12= New(User1,["12","小张","84","女","四川巴中","业主","2020-1-1"]);
    // var initUser13= New(User1,["13","小兰","233","女","四川乐山","业主","2020-1-1"]);
    // var initUser14= New(User1,["14","张黄","854","男","四川成都","租户","2020-1-1"]);
    // var initUser15= New(User1,["15","小吕","452","女","四川绵阳","租户","2020-1-1"]);
    // var initUser16= New(User1,["16","小张","84","女","四川巴中","业主","2020-1-1"]);
    // var initUser17= New(User1,["17","小兰","233","女","四川乐山","业主","2020-1-1"]);
    // var initUser18= New(User1,["18","张黄","854","男","四川成都","租户","2020-1-1"]);
    // var initUser19= New(User1,["19","小吕","452","女","四川绵阳","租户","2020-1-1"]);
    // var initUser20= New(User1,["20","小张","84","女","四川巴中","业主","2020-1-1"]);
    // users1[initUser1.xh] = initUser1;
    // users1[initUser2.xh] = initUser2;
    // users1[initUser3.xh] = initUser3;
    // users1[initUser4.xh] = initUser4;
    // users1[initUser5.xh] = initUser5;
    // users1[initUser6.xh] = initUser6;
    // users1[initUser7.xh] = initUser7;
    // users1[initUser8.xh] = initUser8;
    // users1[initUser9.xh] = initUser9;
    // users1[initUser10.xh] = initUser10;
    // users1[initUser11.xh] = initUser11;
    // users1[initUser12.xh] = initUser12;
    // users1[initUser13.xh] = initUser13;
    // users1[initUser14.xh] = initUser14;
    // users1[initUser15.xh] = initUser15;
    // users1[initUser16.xh] = initUser16;
    // users1[initUser17.xh] = initUser17;
    // users1[initUser18.xh] = initUser18;
    // users1[initUser19.xh] = initUser19;
    // users1[initUser20.xh] = initUser20;
//     return users1;
// }
/**
 * 首次加载页面执行方法
 */

// function loadUserDatas(){
    // var userArray = initUserDatas();
    // addRowData(userArray);
    // refreshDatas(users);
    // yemashu();
    // fanye1();
    // var userArray1 = initUserDatas1();
    // addRowData1(userArray1);
    // refreshDatas1(users1);
    // // fanye1();
    // yemashu1();
    // fanye11();
// }
//用户操作
function add(param){
//获得操作类别
    document.getElementById("myModalLabel").innerText="添加用户";
    operateType = "add";

}
function add1(param){
//获得操作类别
    document.getElementById("myModalLabel").innerText="添加用户";
    operateType1 = "add1";

}
//删除
function shanchu(odj) {
    var i= parseInt($(odj).parent().parent().find("th")[0].innerText) ;
    delete users[i];
    $(odj).parent().parent().remove();
    yemashu();
    fanye2();
    yemaheshuj();
}
function shanchu1(odj) {
    var i= parseInt($(odj).parent().parent().find("th")[0].innerText) ;
    delete users1[i];
    $(odj).parent().parent().remove();
    yemashu1();
    fanye21();
    yemaheshuj1();
}

//编辑
    function bianji(odj) {
        var i= parseInt($(odj).parent().parent().find("th")[0].innerText) ;
        var modal_body = document.getElementById("modal-body");
        var inputElements=  modal_body.getElementsByTagName("input");
        document.getElementById("myModalLabel").innerText="修改用户";
        inputElements[0].value=users[i].xh;
        inputElements[1].value=users[i].xm;
        inputElements[2].value=users[i].dianhua;
        inputElements[3].value=users[i].xb;
        inputElements[4].value=users[i].zz;
        inputElements[5].value=users[i].zhlx;
        inputElements[6].value=users[i].sj;
        operateType = "add";
    }
function bianji1(odj) {
    var i= parseInt($(odj).parent().parent().find("th")[0].innerText) ;
    var modal_body1 = document.getElementById("modal-body");
    var inputElements1=  modal_body1.getElementsByTagName("input");
    document.getElementById("myModalLabel").innerText="修改用户";
    inputElements1[0].value=users1[i].xh;
    inputElements1[1].value=users1[i].xm;
    inputElements1[2].value=users1[i].dianhua;
    inputElements1[3].value=users1[i].xb;
    inputElements1[4].value=users1[i].zz;
    inputElements1[5].value=users1[i].zhlx;
    inputElements1[6].value=users[i].sj;
    operateType1 = "add1";
}

//姓名查询
xingming.keyup(function () {
    if(xingming.val()){
        for(var i in users){
            if(users[i].xm.indexOf(xingming.val()) >= 0){
                searchUsers[users[i].xh] = users[i];
                refreshDatas(searchUsers);
            }
        }
    }else{
        for(var i in users){
                searchUsers[users[i].xh] = users[i];
                refreshDatas(searchUsers);
        }
    }
    searchUsers={};
    yemashu();
    fanye1();
    shanchuyemian=1;
    yemaheshuj();
})
xingming1.keyup(function () {
    if(xingming1.val()){
        for(var i in users1){
            if(users1[i].xm.indexOf(xingming1.val()) >= 0){
                searchUsers1[users1[i].xh] = users1[i];
                refreshDatas1(searchUsers1);
            }
        }
    }else{
        for(var i in users1){
            searchUsers1[users1[i].xh] = users1[i];
            refreshDatas(searchUsers1);
        }
    }
    searchUsers1={};
    yemashu1();
    fanye11();
    shanchuyemian1=1;
    yemaheshuj1();
})
//电话查询
dianhua.keyup(function () {
    if(dianhua.val()){
        for(var i in users){

            if(users[i].dianhua.indexOf(dianhua.val()) >= 0){
                searchUsers[users[i].xh] = users[i];
                refreshDatas(searchUsers);
            }
        }
    }else{
        for(var i in users){
            searchUsers[users[i].xh] = users[i];
            refreshDatas(searchUsers);
        }
    }
    searchUsers={};
    yemashu();
    fanye1();
    shanchuyemian=1;
    yemaheshuj();
})
dianhua1.keyup(function () {
    if(dianhua1.val()){
        for(var i in users1){

            if(users1[i].dianhua.indexOf(dianhua1.val()) >= 0){
                searchUsers1[users1[i].xh] = users1[i];
                refreshDatas1(searchUsers1);
            }
        }
    }else{
        for(var i in users1){
            searchUsers1[users1[i].xh] = users1[i];
            refreshData1s(searchUsers1);
        }
    }
    searchUsers1={};
    yemashu1();
    fanye11();
    shanchuyemian1=1;
    yemaheshuj1();
})
//地址查询
dizhi.keyup(function () {
    if(dizhi.val()){
        for(var i in users){
            if(users[i].zz.indexOf(dizhi.val()) >= 0){
                searchUsers[users[i].xh] = users[i];
                refreshDatas(searchUsers);
            }
        }
    }else{
        for(var i in users){
            searchUsers[users[i].xh] = users[i];
            refreshDatas(searchUsers);
        }
    }
    searchUsers={};
    yemashu();
    fanye1();
    shanchuyemian=1;
    yemaheshuj();
})
dizhi1.keyup(function () {
    if(dizhi1.val()){
        for(var i in users1){
            if(users1[i].zz.indexOf(dizhi1.val()) >= 0){
                searchUsers1[users[i].xh] = users1[i];
                refreshDatas1(searchUsers1);
            }
        }
    }else{
        for(var i in users1){
            searchUsers1[users1[i].xh] = users1[i];
            refreshData1s(searchUsers1);
        }
    }
    searchUsers1={};
    yemashu1();
    fanye11();
    shanchuyemian1=1;
    yemaheshuj1();
})
//住户类型查询
zhuhuleixing.keyup(function () {
    if(zhuhuleixing.val()!="全部"){
        for(var i in users){
            if(users[i].zhlx.indexOf(zhuhuleixing.val()) >= 0){
                searchUsers[users[i].xh] = users[i];
                refreshDatas(searchUsers);
            }
        }
    }else{
        for(var i in users){
            searchUsers[users[i].xh] = users[i];
            refreshDatas(searchUsers);
        }
    }
    searchUsers={};
    yemashu();
    fanye1();
    shanchuyemian=1;
    yemaheshuj();
})
zhuhuleixing1.keyup(function () {
    if(zhuhuleixing1.val()!="全部"){
        for(var i in users1){
            if(users1[i].zhlx.indexOf(zhuhuleixing1.val()) >= 0){
                searchUsers1[users1[i].xh] = users1[i];
                refreshDatas1(searchUsers1);
            }
        }
    }else{
        for(var i in users1){
            searchUser1s[users1[i].xh] = users1[i];
            refreshDatas1(searchUsers1);
        }
    }
    searchUsers1={};
    yemashu1();
    fanye11();
    shanchuyemian1=1;
    yemaheshuj1();
})
// //重置
// chongzhi.click(function () {
//     for(var i in users){
//         searchUsers[users[i].xh] = users[i];
//         refreshDatas(searchUsers);
//     }
//     yemashu();
//     fanye1();
//     shanchuyemian=1;
//     yemaheshuj();
// })
// chongzhi1.click(function () {
//     for(var i in users1){
//         searchUsers1[users1[i].xh] = users1[i];
//         refreshDatas1(searchUsers1);
//     }
//     yemashu1();
//     fanye11();
//     shanchuyemian1=1;
//     yemaheshuj1();
// })
//页面数
function yemashu() {
    var yema=$(".section1 .yema");
    var neirong=$("#profile #tbody tr");
    var yema1=Math.ceil(neirong.length/8);
    var html="";
    if(yema1>0){
        for (var i=1;i<=yema1;i++){
            html=html+"<button onclick='fanye(this)'>"+i+"</button>";
        }
        yema[0].innerHTML=html;
        html="";
    }
}
function yemashu1() {
    var yema=$(".section1 .yema1");
    var neirong=$("#messages #tbody1 tr");
    var yema1=Math.ceil(neirong.length/8);
    var html="";
    if(yema1>0){
        for (var i=1;i<=yema1;i++){
            html=html+"<button onclick='fany1(this)'>"+i+"</button>";
        }
        yema[0].innerHTML=html;
        html="";
    }
}
//翻页
function fanye(odj) {
    var neirong=$("#profile #tbody tr");
    neirong.css("display","none");
    shanchuyemian=odj.innerText;
    for(var i=0;i<neirong.length;i++){
        if(i>=odj.innerText*8-8&&i<odj.innerText*8){
            if(i==neirong.length)break;
            neirong[i].style.display="table-row";
        }
    }
    yemaheshuj();
}

function fany1(odj) {
    var neirong=$("#messages #tbody1 tr");
    neirong.css("display","none");
    shanchuyemian1=odj.innerText;
    for(var i=0;i<neirong.length;i++){
        if(i>=odj.innerText*8-8&&i<odj.innerText*8){
            if(i==neirong.length)break;
            neirong[i].style.display="table-row";
        }
    }
    yemaheshuj1();
}
//加载翻页
function fanye1() {
    var neirong=$("#profile #tbody tr");
    neirong.css("display","none");
    for(var i=0;i<8;i++){
        if(i>=0&&i<8){
            if(i==neirong.length)break;
            neirong[i].style.display="table-row";
        }
    }
}
function fanye11() {
    var neirong=$("#messages #tbody1 tr");
    neirong.css("display","none");
    for(var i=0;i<8;i++){
        if(i>=0&&i<8){
            if(i==neirong.length)break;
            neirong[i].style.display="table-row";
        }
    }
}


function fanye2(){
    var neirong=$("#profile #tbody tr");
    neirong.css("display","none");
    for(var i=0;i<neirong.length;i++){
        if(i>=shanchuyemian*8-8&&i<shanchuyemian*8){
            if(i==neirong.length)break;
            neirong[i].style.display="table-row";
        }
    }
}
function fanye21(){
    var neirong=$("#messages #tbody1 tr");
    neirong.css("display","none");
    for(var i=0;i<neirong.length;i++){
        if(i>=shanchuyemian1*8-8&&i<shanchuyemian1*8){
            if(i==neirong.length)break;
            neirong[i].style.display="table-row";
        }
    }
}


function yemaheshuj() {
var yemaheshujun=$(" .yemaheshujun");
    var neirong=$("#profile #tbody tr");
    yemaheshujun.text("当前页面："+shanchuyemian+" 一共"+neirong.length+"条数据")
}
function yemaheshuj1() {
    var yemaheshujun1=$(" .yemaheshujun1");
    var neirong=$("#messages #tbody1 tr");
    yemaheshujun1.text("当前页面："+shanchuyemian1+" 一共"+neirong.length+"条数据")
}




